//#define _CRT_SECURE_NO_WARNINGS
//#include<iostream>
//#include<string>
//using namespace std;
//
//void test()
//{
	//string s1("hello world");
	//s1.insert(5,"$$$");
	//s1.insert(5, 30, '%');
	//s1.insert(s1.begin() + 3, 'v');
	//cout << s1 << endl;
	//s1.erase(5, 2);
	//cout << s1 << endl;

	//string s1("hello world!");
	//cout << s1 << endl;
	//s1.erase(4);
	//s1.assign("what are you?");
	//cout << s1 << endl;

	//string s1("hello world! lsa soqdja saas");
	//cout << s1 << endl;
	//s1.replace(s1.find(' '), 1, "(())");
	//cout << s1 << endl;
	//string s1("hello world hello fast    ");
	//size_t i = 0;
	//while (s1.find(' ', i) != string::npos)
	//{
	//	i = s1.find(' ', i + 1);
	//	s1.replace(i, 1, "@");
	//}
	//cout << s1 << endl;
	//string s1("hello world hello bit");
	//cout << s1 << endl;
	//string s2;
	//for (auto ch : s1)
	//{
	//	if (ch == ' ')
	//	{
	//		s2 += "*+*";
	//	}
	//	else
	//	{
	//		s2 += ch;
	//	}
	//}
	//s2.swap(s1);
	//cout << s1 << endl;
	//string filename("test.cpp");
	//FILE* fout = fopen(filename.c_str(), "r");
	//char ch = fgetc(fout);
	//while (ch != EOF)
	//{
	//	cout << ch;
	//	ch = fgetc(fout);
	//}

	/*string s1("test.cpp");
	string s2("main.exe");
	string::iterator sit1 = s1.begin() + s1.find('.');
	while (sit1 != s1.end())
	{
		cout << *sit1;
		++sit1;
	}
	cout << endl;
	string::iterator sit2 = s2.begin() + s2.find('.');
	while (sit2 != s2.end())
	{
		cout << *sit2;
		++sit2;
	}*/
	//string s1("test.cpp");
	//string s2("main.exe.cpp.c.tar.zip.doc.exc.txt");
	//size_t pos1 = s1.find('.');
	//if (pos1 != string::npos)
	//{
	//	//cout << s1.substr(pos1, string::npos) << endl;
	//	string suff = s1.substr(pos1, s1.size() - pos1);
	//	cout << suff << endl;
	//}
	//size_t pos2 = s2.find('.');
	//size_t pos2End = 0;
	//while(pos2 != string::npos)
	//{
	//	pos2End = s2.find('.', pos2 + 1);
	//	cout << s2.substr(pos2, pos2End - pos2) << endl;
	//	pos2 = pos2End;
	//}
	/*string s1("test.cpp");
	string s2("main.exe.cpp.c.tar.zip.doc.exc.txt");
	size_t pos2 = s2.rfind('.');
	if (pos2 != string::npos)
	{
		cout << s2.substr(pos2) << endl;
	}*/

	//string s1("https://legacy.cplusplus.com/reference/string/basic_string/substr/");
	//string sub1, sub2, sub3;
	//size_t pos1 = s1.find(':');
	//sub1 = s1.substr(0, pos1);
	//cout << sub1 << endl;
	//size_t pos2 = s1.find('/', pos1 + 3);
	//sub2 = s1.substr(pos1 + 3, pos2 - pos1 - 3);
	//cout << sub2 << endl;
	//sub3 = s1.substr(pos2);
	//cout << sub3 << endl;
//	string str("PLease, replace the vowels in this sentence by asterisks.");
//	string::size_type found = str.find_first_of("aeiou");
//	while (found != string::npos)
//	{
//		str[found] = '*';
//		found = str.find_first_of("aeiou", found + 1);
//	}
//	cout << str << '\n';
//
//}

//void test2()
//{
	//string s1("PLease, replace the vowels in this sentence by asterisks.");
	//size_t pos = s1.find_first_not_of("abc");
	//while (pos != string::npos)
	//{
	//	s1[pos] = '*';
	//	pos = s1.find_first_not_of("abc", pos + 1);;
	//}
	//cout << s1 << endl;

//	string s1("hello");
//	string s2("world");
//	cout << s1 + s2 << endl;
//}

//void test3()
//{
//	string s1("PLease, replace the vowels in this sentence by asterisks.");
//	//cin >> s1;
//	size_t pos = s1.rfind(' ');
//	//if(pos!=stroin)
//	if (s1[s1.size() - 1] < 'z' && s1[s1.size() - 1]>'a')
//		cout << s1.size() - 1 - pos << endl;
//	else
//		cout << s1.size() - 1 - pos - 1 << endl;
//}
//#include <iostream>
//using namespace std;

//int main()
//{
//	string s1("ABSIB T");
//	//cin >> s1;
//	size_t pos = s1.rfind(' ');
//	if (pos != string::npos)
//	{
//		//cout<<pos;
//		cout << s1.size() - 1 - pos << endl;
//	}
//	else
//	{
//		cout << s1.size() << endl;
//	}
//}

#include"string.h"
int main()
{
	fast::test_string();
	return 0;
}







